Simple Expressions

Scripts are made up of smaller units called expressions.  Expressions are small bits of code that, when run, have a value.  For example, the following expressions yield these results:

 Expression

ﬁ Result, Remarks

3.14159
ﬁ 3.14159
a number is a simple expression

"Hello"
ﬁ "Hello"
so is a string of characters in quotes

3 + 4
ﬁ 7

arithmetic expression

3 + 4 * 5
ﬁ 23

follows normal math rules 

"abc" & "def"
ﬁ "abcdef"
& is a string operator

"abc" @ 2
ﬁ "b"

the second character of the string

3 < 4
ﬁ true
comparison of two numbers

Trying the Examples

You can try these expressions out for yourself using the system.  We suggest that you create a Glyphic Codeworks document in your notebook for use just with this manual.  After you create the document, turn to it and open a new workspace.  When you are ready to take a break from the manual, simply turn back to the table of contents of the notebook.  Don’t close the workspace or other windows.  When you turn back to the document, they will still be open.

To open a new workspace:
1.
Create a new Codeworks document in your notebook and turn to it.  Use the ‘Codeworks, Folders’ stationary.
2.
Tap on New Workspace… from the Utilities menu.  A new workspace appears.

To execute and expression in a workspace:
1.
Enter the expression in the text editor portion of the workspace.  Pay close attention to the formatting and punctuation of the expression: computers are very fussy.
2.
Select the expression. 
3.
Tap Save at the top of the workspace.  The result of the operation appears to the right of the ‘result’ entry in list at the top half of the workspace.  If it is not visible, then scroll the list so it is.

Multiple Expressions

You can execute more than one expression at a time.  To do this, the expressions must end periods.  Each expression is executed in turn, and the result of only the last expression is the result of executing the whole group.  Consider:

3 + 4.

1 / 5.

"Hello".

When all three lines are selected and executed, first the system computes the number 7, then the number 0.2, and finally the string "Hello" which is the result.

»
Multiple Expressions don’t have to be on separate lines, only separated by periods.  The final period is optional.